<?php
	class contractmodel extends Model {
		function contractmodel()
		{
			parent::Model();			
		}
		
		function add($data)
		{
            $this->db->set('create_date', 'NOW()', FALSE); 
			$this->db->insert('contractus', $data);
			return $this->db->insert_id();
		}
		
				
		function getAll()
		{
			$this->db->where('is_active', '1');
			$this->db->order_by("create_date", "desc"); 
			$query = $this->db->get('contractus');
			return $query->result();
		}
		
		function delete($data)
		{	
			$dataDB['is_active'] = '0';	
            $this->db->where('contract_id', $data['contract_id']);
            $this->db->set('update_date', 'NOW()', FALSE); 
            $this->db->set('update_by', "'". $this->session->userdata('username') ."'", FALSE);
			$this->db->update('contractus', $dataDB); 
		}
	}
	
	
?>